import 'dart:io';

void main() {
  //User Input
  print("******Program to ask user identity*****\n");
  print("Enter your firstname: ");
  String? firstname = stdin.readLineSync();

  print("Enter your lastname: ");
  String? lastname = stdin.readLineSync();

  print("Enter your Nationality: ");
  String? nationality = stdin.readLineSync();

  print(
    "Your fullname is $firstname $lastname and you're a $nationality by nationality",
  );

  PaymentProcessor payment = PaymentProcessor("122345678", 1200);
  payment.processPayment();
}

class PaymentProcessor {
  String? cardNumber;
  double? amount;

  PaymentProcessor(this.cardNumber, this.amount);

  String maskCardNumber(String cardNumber) {
    return "****_****_****_" + cardNumber.substring(cardNumber.length - 4);
  }

  void processPayment() {
    var mask = maskCardNumber(cardNumber ?? "");
    print("Processing Payment of $amount\$ from card: $mask");
  }
}
